﻿using System;
using VisualWip.Core;
using VisualWip.Core.Columns;

namespace VisualWip.PresentationModel.WorkItem
{
    public class SingleWorkItemViewModel : ColumnViewModelBase
    {
        private readonly SingleWorkItemColumn _column;

        public SingleWorkItemViewModel(Application application, SingleWorkItemColumn column,
                                       IColumnBuilder columnBuilder)
            : base(application, column, columnBuilder)
        {
            _column = column;
        }

        public WorkItemViewModel WorkItem { get; set; }

        protected override void ColumnRefreshDone(object sender, EventArgs e)
        {
            base.ColumnRefreshDone(sender, e);
            WorkItem = new WorkItemViewModel(_column.WorkItem, _column);
            OnPropertyChanged(this, () => WorkItem);
        }
    }
}